# $Id: PKGBUILD 83710 2013-02-04 14:57:08Z seblu $
# Maintainer: Sébastien Luttringer <seblu@archlinux.org>
# Contributor: Andrea Zucchelli <zukka77@gmail.com>

pkgname=keepalived
pkgver=1.2.7
pkgrel=2
pkgdesc='Failover and monitoring daemon for LVS clusters'
arch=('i686' 'x86_64')
url='http://www.keepalived.org/'
license=('GPL2')
backup=('etc/keepalived/keepalived.conf')
depends=('openssl' 'popt' 'libnl1')
source=("http://www.keepalived.org/software/$pkgname-$pkgver.tar.gz"
        'keepalived.service')
md5sums=('8551a34ee048895dbe5350a031ff29c1'
         'edbeda8c8777cf36110c1623e49bc5c9')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --sysconfdir=/etc
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  # clean pacakge init scripts
  rm -r "$pkgdir/etc/rc.d" "$pkgdir/etc/sysconfig"
  # move examples to /usr/share
  install -d -m 755 "$pkgdir/usr/share/$pkgname"
  mv "$pkgdir/etc/keepalived/samples" "$pkgdir/usr/share/$pkgname/samples"
  # systemd
  cd "$srcdir"
  install -D -m 644 $pkgname.service \
    "$pkgdir/usr/lib/systemd/system/$pkgname.service"

}

# vim:set ts=2 sw=2 et:
